package com.itheima;

import com.itheima.config.SpringConfig;
import com.itheima.domain.Account;
import com.itheima.service.AccountService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class App {
    public static void main(String[] args) {
        ApplicationContext ctx = new AnnotationConfigApplicationContext(SpringConfig.class);
        //获取AccountService类
        AccountService accountService = ctx.getBean(AccountService.class);
        //使用类中的方法 1.由SqlSessionFactoryBean获取实现类和生成session对象,由MapperScannerConfigurer
//        获取映射对象,在获取AccountService类执行dao的方法,而dao方法通过之前的session对象与映射对象
//        执行(在ioc中存在dao的class文件)
        Account ac = accountService.findById(1);
        System.out.println(ac);
    }
}
